package vue;

import javax.swing.JMenu;
import javax.swing.JMenuBar;
import javax.swing.JMenuItem;

import model.Environnement;
import model.ThreadEnvironnement;

import controleur.ChargeGrille;
import controleur.Preference;
import controleur.SauveGrille;

public class Menu extends JMenuBar{

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;

	public Menu (Environnement env, ThreadEnvironnement t, PanneauPrincipal panPrinc) {
		super();
		JMenu file = new JMenu("Fichier");
		file.setMnemonic('F');
		JMenuItem openItem = new JMenuItem("Ouvrir");
		openItem.setMnemonic('O');
		openItem.addActionListener(new ChargeGrille(env, panPrinc));
		file.add(openItem);
		JMenuItem saveItem = new JMenuItem("Sauver");
		saveItem.setMnemonic('S');
		saveItem.addActionListener(new SauveGrille(env));
		file.add(saveItem);
		JMenuItem exitItem = new JMenuItem("Quitter");
		exitItem.setMnemonic('Q');
		file.add(exitItem);
		
		JMenu edition = new JMenu("Edition");
		edition.setMnemonic('E');
		JMenuItem preferenceItem = new JMenuItem("Préférence");
		preferenceItem.setMnemonic('P');
		edition.add(preferenceItem);
		preferenceItem.addActionListener(new Preference(env, t, panPrinc));
		add(file);
		add(edition);
	}
}
